package com.kernowsoft.wavefx.sync;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class WaveFxSyncService extends Service {

	public static WaveFxSyncAdapter sSyncAdapter = null;
	private static final Object sSyncAdapterLock = new Object();	// for syncronization
	
	@Override
	public void onCreate() {
		super.onCreate();
		
		// create sync adapter as a singleton:
		synchronized (sSyncAdapterLock) {
			if(sSyncAdapter == null) {
				sSyncAdapter = new WaveFxSyncAdapter(getApplicationContext(), true);
			}
		}
	}
	
	@Override
	public IBinder onBind(Intent intent) {
		 /*
         * Get the object that allows external processes
         * to call onPerformSync(). The object is created
         * in the base class code when the SyncAdapter
         * constructors call super()
         */
        return sSyncAdapter.getSyncAdapterBinder();
	}

}
